package com.lujieni.springbootmybatis.controller.admin;

import com.lujieni.springbootmybatis.aop.DataPermission;
import com.lujieni.springbootmybatis.dao.WebsiteMsgDao;
import com.lujieni.springbootmybatis.po.WebsiteMsgDO;
import com.lujieni.springbootmybatis.service.DataPermissionService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：Jie Ni
 * @Date: 2025/10/22 17:42
 * @Description:
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/permission")
public class DataPermissionController {

    private final WebsiteMsgDao websiteMsgDao;

    private final DataPermissionService dataPermissionService;

    @GetMapping("/hasPermission")
    public WebsiteMsgDO hasPermission() {
        return websiteMsgDao.selectById(1L);
    }

    @GetMapping("/nonePermission")
    @DataPermission(enable = false)
    public WebsiteMsgDO nonePermission() {
         dataPermissionService.selectWebsiteMsg(2L);
         return websiteMsgDao.selectById(1L);
    }


}
